using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using Munim.Fame.DataAccess.NHibernate.Mapping;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
//using Munim.Fame.DataAccess.Mapping;

namespace Munim.Fame.DataAccess.NHibernate
{
    public static class NHibernateHelper
    {
        public static void CreateDb(Configuration cfg)
        {
            new SchemaExport(cfg).Execute(true, true, false);
            //new SchemaExport(cfg).Create(true, true);
        }

        public static FluentConfiguration GetConfiguration()
        {
            return Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008
                              .ConnectionString(c => c.FromConnectionStringWithKey("fame"))
                              .ShowSql())
                .Mappings(m => m.FluentMappings.AddFromAssemblyOf<MemberMap>());
        }
    }
}
